package cn.yl.order.server.config;

import cn.yl.api.server.util.PayConfig;
import com.github.wxpay.sdk.WXPayConfig;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * @author hyl
 */
@Component
public class WechatPayConfig implements WXPayConfig {

//    private byte[] certData;
//
//    public WechatPayConfig() throws Exception {
//        String certPath = "/path/to/apiclient_cert.p12";
//        File file = new File(certPath);
//        InputStream certStream = new FileInputStream(file);
//        this.certData = new byte[(int) file.length()];
//        certStream.read(this.certData);
//        certStream.close();
//    }

    @Override
    public String getAppID() {
        return "wx307113892f15a42e";
    }

    @Override
    public String getMchID() {
        return "1508236581";
    }

    @Override
    public String getKey() {
        return "HJd7sHGHd6djgdgFG5778GFfhghghgfg";
    }

    @Override
    public InputStream getCertStream() {
        return null;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }
    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }
}
